package com.jzo2o.foundations.controller.consumer;

import com.jzo2o.foundations.model.dto.response.ServeAggregationSimpleResDTO;
import com.jzo2o.foundations.model.dto.response.ServeAggregationTypeSimpleResDTO;
import com.jzo2o.foundations.model.dto.response.ServeCategoryResDTO;
import com.jzo2o.foundations.service.IServeRegionService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController("ServeController")
@RequestMapping("/customer/serve")
@Api(tags = "用户端 - 门户相关接口")
public class ServeController {
    @Autowired
    private IServeRegionService serveRegionService;

    /**
     * 根据区域id查询门户对应服务分类以及服务内容
     * @param regionId
     * @return
     */
    @GetMapping("/firstPageServeList")
    public List<ServeCategoryResDTO> getServeCategoryList(@RequestParam String regionId){
        List<ServeCategoryResDTO> list= serveRegionService.getServeCategoryList(regionId);
        return list;
    }

    /**
     * 查询热门服务，只返回排名第一的
     * @param regionId
     * @return
     */
    @GetMapping("/hotServeList")
    public  List<ServeAggregationSimpleResDTO>  getHotServeList(@RequestParam String regionId){
        List<ServeAggregationSimpleResDTO>  list= serveRegionService.getHotServeList(regionId);
        return list;
    }

    /**
     *   全部服务列表
     * @param regionId
     * @return
     */
    @GetMapping("/serveTypeList")
    public List<ServeAggregationTypeSimpleResDTO> getAllType(Long regionId){
        return serveRegionService.getAllTypeByRegionId(regionId);
    }
    /**
     *   查询服务详情
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public ServeAggregationSimpleResDTO serveDetail(@PathVariable("id") Long id){
        return serveRegionService.getServeDetailById(id);
    }


}
